// BWBackStitchLayer - layer for backstitches

#import "BWLayer.h"
#import "BWBackStitchStorage.h"
#import "BWGridGeometry.h"

@class BWBackStitchSet;
@class BWBackStitch;
@class BWBackStitchChangeList;

@interface BWBackStitchLayer : BWLayer <NSCoding>
{
    BWBackStitchSet *backStitchSet;
    BWBackStitchChangeList *changeList;

    BWBackStitch *selectedStitch;
    BWBackStitch_Part overridePart;
    int overrideRow, overrideColumn;
    BWGrid_Quadrant overrideQuadrant;
}

- (void) setChangeList: (BWBackStitchChangeList *) changeList;
- (void) applyChanges;

- (BWBackStitch *) stitchUnderPoint: (NSPoint) point
                               part: (BWBackStitch_Part *) part;

- (void) replaceThread: (BWThread *) search
            withThread: (BWThread *) replace;

@end // BWBackStitchLayer


@interface BWBackStitchLayer (Degubbing)
- (void) addStitchesForDebugging;
@end // Degubbing


@interface BWBackStitchLayer (StitchEditing)

- (void) selectStitch: (BWBackStitch *) stitch;

- (void) setOverrideForPart: (BWBackStitch_Part) part
                      toRow: (int) row
                     column: (int) column
                   quadrant: (BWGrid_Quadrant) quadrant;

- (void) commitOverride;

- (void) removeSelection;

@end // BWBackStitchLayer
